<!--link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl.WWWROOT_BACKEND; ?>/css/form.css"/-->

<div class="wd-form">

<?php $form = $this->beginWidget('GxActiveForm', array(
	'id' => 'products-image-form',
	//'enableAjaxValidation' => true,
  'htmlOptions'=>array('enctype'=>'multipart/form-data'),
));
?>
	<fieldset>
		<div class="wd-input">
			<?php echo $form->labelEx($model,'name'); ?>
			<?php echo $form->textField($model,'name',array('size'=>30,'maxlength'=>64)); ?>
			<?php echo $form->error($model,'name'); ?>
		</div>
		<div class="wd-input">
	    	<?php echo $form->labelEx($model,'image'); ?>
			<div class="image-form">
			<?php if (isset($model->image) && ($model->image != 'NULL')): ?>
				<?php if(file_exists(Yii::app()->createUrl('/').'wwwroot/upload_files/product_images/thumbs/' . $model->image)): ?>
					<img src="<?php echo  Yii::app()->createUrl('/').'/wwwroot/upload_files/product_images/thumbs/' . $model->image; ?>" width="100" height="70"/>
				<?php else : ?>
					<?php echo CHtml::image('/wwwroot/upload_files/product_images/no-image.png', 'Image', array(
								'width'		=>	'100',
								'height'	=>	'70'
					)); ?>
				<?php endif ?>
				<div class="clr"></div>
			<?php endif ?>
			<?php echo $form->fileField($model,'image'); ?>
			</div>
			<?php echo $form->error($model,'image'); ?>
		</div><!-- wd-input -->
		
		<div class="wd-input">
			<?php echo $form->labelEx($model,'description'); ?>
			<?php echo $form->textArea($model,'description',array('rows'=>6, 'cols'=>160)); ?>
			<?php echo $form->error($model,'description'); ?>
		</div>
		
		<div class="wd-submit buttons">
			<?php echo GxHtml::submitButton(Yii::t('app', 'Save')); ?>
		</div>
	</fieldset>

<?php $this->endWidget(); ?>